package stm.liyiruo.sign2pdf.configure;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import stm.liyiruo.sign2pdf.config.PDFConfig;
import stm.liyiruo.sign2pdf.service.IPDFService;
import stm.liyiruo.sign2pdf.service.impl.PDFServiceImpl;

/**
 * @author liyiruo
 * @Description
 * @Date 2021/8/11 下午3:42
 */
@Configuration
@ConditionalOnClass(value = {IPDFService.class, PDFServiceImpl.class})
@EnableConfigurationProperties(PDFConfig.class)
@ConditionalOnProperty(prefix = "signpdf",value = "enabled",matchIfMissing = true)
public class PDFAutoConfigure {
    @Bean
    @ConditionalOnMissingBean
    public IPDFService starterService() {
        PDFServiceImpl pdfService = new PDFServiceImpl();
        return pdfService;
    }
}
